<?php
/*************************************************************************************
 *
 *	FileName: /edp/module/ajax_register_check/header_php.php
 *	Desc    : This file is to check the register information .
 *	Author  : Andew
 *	Date    : 2009-12-1
 *
 *************************************************************************************/

	$result['res']=true;    //表示不存在重复email或者匿名
	if( isset( $_GET['type']) )
	{
		$userDAO=GetUserDAO();
		$type=trim($_GET['type']);
		if(($type=='email')&&isset($_GET['email']))
		{
			$email=edp_db_input($_GET['email']);
			if($userDAO->IsEmailExist($email))
				$result['res']=false;
		}
		elseif(($type=='nick')&&isset($_GET['nick']))
		{
			$nick=edp_db_input($_GET['nick']);
			if($userDAO->IsNickExist($nick))
				$result['res']=false;
		}
		elseif(($type=='pwd')&&isset($_GET['pwd']))
		{
			$pwd=edp_db_input($_GET['pwd']);
			$id=intval( edp_db_input($_GET['id']) );
			if(!$userDAO->IsPasswordCorrect($id, $pwd))
				$result['res']=false;
		}
		elseif(($type=='other_email')&&isset($_GET['email']))
		{
			$id=intval( edp_db_input($_GET['id']) );
			$email=edp_db_input($_GET['email']);
			if($userDAO->IsOtherEmailExist($id, $email))
				$result['res']=false;
		}
	}
	echo( json_encode($result) );
?>